import request from './request'

export function query ({currentPage = 1, perPage = 10, pCode, pName} = {}) {
  return request({
    url: '/common/dictParent/list.do',
    method: 'POST',
    body: {currentPage, perPage, pCode, pName}
  })
}

export function create ({pCode, pName, pDesc}) {
  return request({
    url: '/common/dictParent/add.do',
    method: 'POST',
    body: {pCode, pName, pDesc}
  })
}

export function edit ({pCode, pName, pDesc}) {
  return request({
    url: '/common/dictParent/modify.do',
    method: 'POST',
    body: {pCode, pName, pDesc}
  })
}

export function del (pCode) {
  return request({
    url: '/common/dictParent/del.do',
    method: 'POST',
    body: {pCode}
  })
}

export function queryChildAll (pCode) {
  return request({
    url: '/common/dictChild/getDictChild.do',
    method: 'POST',
    body: {pCode}
  })
}

export function queryChild ({currentPage = 1, perPage = 10, pCode, cName, cCode} = {}) {
  return request({
    url: '/common/dictChild/list.do',
    method: 'POST',
    body: {currentPage, perPage, pCode, cName, cCode}
  })
}

export function createChild ({pCode, cCode, cName, cDesc}) {
  return request({
    url: '/common/dictChild/add.do',
    method: 'POST',
    body: {pCode, cCode, cName, cDesc}
  })
}

export function editChild ({id, pCode, cCode, cName, cDesc}) {
  return request({
    url: '/common/dictChild/modify.do',
    method: 'POST',
    body: {id, pCode, cCode, cName, cDesc}
  })
}

export function delChild (id) {
  return request({
    url: '/common/dictChild/del.do',
    method: 'POST',
    body: {id}
  })
}
